FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["BaseService.Host/BaseService.Host.csproj", "BaseService.Host/"]
COPY ["BaseService.EntityFrameworkCore/BaseService.EntityFrameworkCore.csproj", "BaseService.EntityFrameworkCore/"]
COPY ["BaseService.Domain/BaseService.Domain.csproj", "BaseService.Domain/"]
COPY ["BaseService.HttpApi/BaseService.HttpApi.csproj", "BaseService.HttpApi/"]
COPY ["BaseService.Application.Contracts/BaseService.Application.Contracts.csproj", "BaseService.Application.Contracts/"]
COPY ["BaseService.Application/BaseService.Application.csproj", "BaseService.Application/"]
RUN dotnet restore "BaseService.Host/BaseService.Host.csproj"

COPY . .
RUN dotnet publish -c Release -o publish

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
COPY --from=build /src/publish ./
ENTRYPOINT ["dotnet", "BaseService.Host.dll"]